<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Boxs extends Model
{
    protected $fillable = [
        'orderno',
        'name',
        'address',
        'mobile',
        'state',
        'express_out_company',
        'express_out_no',
        'express_in_company',
        'express_in_no',
        'history',
        'creator'
    ];

    public function Assorts()
    {
        return $this->hasMany('App\Assorts','orderno','orderno');
    }

    public function Users()
    {
        return $this->belongsTo('App\User','creator','id');
    }

    public function Keeper()
    {
        return $this->belongsTo('App\User','keeper','id');
    }

    public function getStateAttribute($value)
    {
        return Dics::where('val',$value)->first();
    }
}
